From 53028ff3bb0610f5fb4df360391af9ee23f61cfa Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 27 Feb 2015 13:06:29 +0100 Subject: [PATCH] wayland: Don't use g_error() on connection lost When the Wayland compositor vanishes, all applications connected will receive a SIGPIPE as soon as they try to use wl_display_dispatch(). Do not use g_error() to terminate the applications when this occurs, g_error() means an error in the application while here it's not truly the case. Use g_warning() and exit() instead. Signed-off-by: Olivier Fourdan https://bugzilla.gnome.org/show_bug.cgi?id=745289 --- gdk/wayland/gdkeventsource.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gdk/wayland/gdkeventsource.c b/gdk/wayland/gdkeventsource.c index 1595a3079a..d675ce91e7 100644 --- a/gdk/wayland/gdkeventsource.c +++ b/gdk/wayland/gdkeventsource.c @@ -20,6 +20,7 @@ #include "gdkinternals.h" #include "gdkprivate-wayland.h" +#include #include typedef struct _GdkWaylandEventSource { @@ -160,11 +161,17 @@ _gdk_wayland_display_queue_events (GdkDisplay *display) if (source->pfd.revents & G_IO_IN) { if (wl_display_dispatch (display_wayland->wl_display) < 0) - g_error ("Error dispatching display: %s", g_strerror (errno)); + { + g_warning ("Error %d (%s) dispatching to Wayland display.", + errno, g_strerror (errno)); + exit (1); + } } if (source->pfd.revents & (G_IO_ERR | G_IO_HUP)) - g_error ("Lost connection to wayland compositor"); - + { + g_warning ("Lost connection to Wayland compositor."); + exit (1); + } source->pfd.revents = 0; } -- 2.30.2